#include <filesystem>
#include <iostream>
// #include <format>

using namespace std;
using namespace std::filesystem;

void printDirectoryStructure(const path &p)
{
	if (!exists(p))
	{
		return;
	}

	recursive_directory_iterator begin{p};
	recursive_directory_iterator end{};
	for (auto iter{begin}; iter != end; ++iter)
	{
		const string spacer(iter.depth() * 2, ' ');

		auto &entry{*iter}; // Dereference iter to access directory_entry.

		if (is_regular_file(entry))
		{
			// cout << format("{}File: {} ({} bytes)",
			// 	spacer, entry.path().string(), file_size(entry)) << endl;
			cout << spacer << "File: " << entry.path() << " (" << file_size(entry) << " bytes)" << endl;
		}
		else if (is_directory(entry))
		{
			// cout << format("{}Dir: {}", spacer, entry.path().string()) << endl;
			 cout << spacer<<"Dir: "<< entry.path().string() << endl;
		}
	}
}

int main()
{
	path p{R"(D:\file-decrypted-2)"};
	printDirectoryStructure(p);
}
